
<?	require_once('../CNN/conn.php'); 			// -> Conexão com a base de dados 
	require_once('../CONFIG/funcoes_db.php');   // -> funções com relação à base de dados
	include_once("../CONFIG/config.php");
	
	$redirectTo = "../ADM/area_admin.php?page=entrevista&acao=cad";
	
	
	if ( isset($_GET['msg']) )
	{
		$msg 	= $_GET['msg'];
		$titulo = "Aviso";
		
		echo "<script> jAlert('".$msg."', '".$titulo."'); </script>"; // Plugin jquery.alerts
	}
	
	
	$camposMunic = array("codMunicipio" , "nome");
	$rsMunic	 = select_geral("municipio"	, $camposMunic, $database_conn, $conn); // função em funcoes_db.php
?>
    
    
    <form action="<?=URL_INSERT?>" method="post" name="entrevista" class="formCadastro">
    <fieldset>
        <input type="hidden" name="nome_tabela" value="entrevista" />
        <input type="hidden" name="redirectTo"  value="<?=$redirectTo?>" />

        <table>
        <tr>
        	<td> <label> Cod Entrevista: </label> </td>
        </tr>
        <tr>
            <td>
            	<input type="text" name="codEntrevista" value="<?=ultimoCodigo("entrevista", $database_conn, $conn) + 1 ?>"
          		size="32" readonly="readonly"/>
            </td>
        </tr>
        <tr>
            <td> <label> Entrevistador: </label> </td>
        </tr>
        <tr>
            <td><input type="text" name="entrevistador"></td>
        </tr>
        <tr>
            <td> <label> Data: </label> </td>
        </tr>
        <tr>
            <td><input type="text" name="dataEntrev"></td>
        </tr>
        <tr>
            <td> <label> Cod Município: </label> </td>
        </tr>
        <tr>
            <td>
            	
                <select name="codMunic">
                
                    <option> Selecione... </option>
                    <?
                    while ( $row = mysql_fetch_array($rsMunic) )
                    {	
                        echo '<option value="' .$row['codMunicipio'] .'"> ' .$row['nome'] . '</option>';
                    }
                    ?>
                </select>
                
            </td>
        </tr>
        <tr>
            <td> <label> Cod Supervisão: </label> </td>
        </tr>
        <tr>
            <td><input type="text" name="codSupervisao"></td>
        </tr>
        <tr>
            <td> <label> Microbacia: </label> </td>
        </tr>
        <tr>
            <td><input type="text" name="microbacia"></td>
        </tr>
        <tr>
            <td> <label> Cod Domicilo: </label> </td>
        </tr>
        <tr>
            <td><input type="text" name="codDomicilio"></td>
        </tr>
        <tr>
            <td> <label> Responsavel Residência: </label> </td>
        </tr>
        <tr>
            <td><input type="text" name="responsavelResid"></td>
        </tr>
        <tr>
        	<td> <label> Latitude: </label> </td>
        </tr>
        <tr>
            <td><input type="text" name="latitude"></td>
        </tr>
        <tr>
            <td> <label> Longitude: </label> </td>
        </tr>
        <tr>
            <td><input type="text" name="longitude"></td>
        </tr>
        <tr>
        	<td> <label> Datum: </label> </td>
        </tr>
        <tr>
        	<td><input type="text" name="datum"></td>
        </tr>
        <tr>
            <td> <label> Hora Inicio: </label> </td>
        </tr>
        <tr>
            <td><input type="text" name="horaInicio"></td>
        </tr>
        <tr>
            <td> <label> Hora Termino: </label> </td>
        </tr>
        <tr>
            <td><input type="text" name="horaTermino"></td>
        </tr>
        <tr>
            <td> <label> Anotacoes: </label> </td>
        </tr>
        <tr>
            <td> <textarea name="anotacoes"> </textarea> </td>
        </tr>
        <tr>
            <td><input type="submit" value="Insert record"></td>
        </tr>
        </table>
        
    </fieldset>
    </form>
    
